001 /* EVolve - an Extensible Software Visualization Framework
002 * Copyright (C) 2001-2002 Qin Wang
003 *
004 * This library is free software; you can redistribute it and/or
005 * modify it under the terms of the GNU Library General Public
006 * License as published by the Free Software Foundation; either
007 * version 2 of the License, or (at your option) any later version.
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Library General Public License for more details.
013 *
014 * You should have received a copy of the GNU Library General Public
015 * License along with this library; if not, write to the
016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
017 * Boston, MA 02111-1307, USA.
018 */
019
020 /*
021 * EVolve is distributed at http://www.sable.mcgill.ca/EVolve/
022 */
023
024 package EVolve.data;
025
026 import java.util.*;
027
028 public class FieldDefinition implements Cloneable{
029 private String name;
030 private int index;
031 private ArrayList property;
032 private int reference;
033 private String description;
034
035 FieldDefinition(String name, int index, int reference, String description) {
036 this.name = name;
037 this.index = index;
038 this.property = new ArrayList();
039 this.reference = reference;
040 this.description = description;
041 }
042
043 void addProperty(String property) {
044 this.property.add(property);
045 }
046
047 public String getName() {
048 return name;
049 }
050
051 public int getIndex() {
052 return index;
053 }
054
055 public boolean hasProperty(String property) {
056 return ((property == null) || (this.property.indexOf(property) != -1));
057 }
058
059 public int getReference() {
060 return reference;
061 }
062
063 public String getDescription() {
064 return description;
065 }
066
067 public String[] getProperties() {
068 String[] returnVal = new String[property.size()];
069 for (int i=0; i< returnVal.length; i++) {
070 returnVal[i] = (String)property.get(i);
071 }
072
073 return returnVal;
074 }
075
076 public Object clone() {
077 FieldDefinition o = null;
078 try {
079 o = (FieldDefinition)super.clone();
080 } catch (CloneNotSupportedException e) {
081 e.printStackTrace();
082 return null;
083 }
084
085 o.name = name;
086 o.property = (ArrayList)property.clone();
087 o.description = description;
088 return o;
089 }
090 }